import React from "react";
// import styles from "./index.less";
import { _local } from '@/utils/localStorage';
import { Upload, message, Button } from "antd";
// import { UploadOutlined } from "@ant-design/icons";

const props = {
  name: "file",
  action: "/api/getFiles",
  headers: {
    'Authorization':`Bearer ${_local.get("x-auth-token")}`,
  },
  onChange(info) {
    console.log(info)
    if (info.file.status !== "uploading") {
      console.log(info.file, info.fileList);
    }
    if (info.file.status === "done") {
      message.success(`${info.file.name} file uploaded successfully`);
    } else if (info.file.status === "error") {
      message.error(`${info.file.name} file upload failed.`);
    }
  },
};

export default () => (
  <div>
    <div id="components-upload-demo-basic">
      <Upload {...props}>
        <Button>
           导入
        </Button>
      </Upload>
    </div>
  </div>
);
